{template 'common/header'}
<script  async="true" src="{MODULE_URL}public/sweetalert/sweetalert2.common.js"></script>
<link rel="stylesheet" type="text/css" href="{MODULE_URL}public/css/tab.css"> 
<link href="{MODULE_URL}template/web/css/classlist.css" rel="stylesheet" type="text/css">
<style type="text/css">
.right-content{padding: 0;}
.border-l:{
    border-left: #666 1px solid;
}
.border-r:{
    border-right: : #666 1px solid;
} 
.list_th{
  height: 30px; 
  line-height: 30px;

}
.list_tr{
  height: 100px;  
  line-height: 100px;
}
.J_add{
  margin-top:25px;
}
.goods-img{
  width: 80px;
  height:80px;
  margin: 10px;
  display: block;
}
.isok{
    background: #5CA209;
}
.isoff{
    background: #9c9c9c;
}
.gl{
    height: 20px !important;
}
.td span{
    display: block;
    font-weight: bold;
}
.info{
    width: 100%;
    height: 25px;
    text-align: center;
    line-height: 25px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
}
.td .left_padding {
    padding-left: 10px !important;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.ordertype{
    font-size: 12px;   
    border-radius: 2px;
    color: #FFFFFF;
    text-decoration: none;
    width: 80px;
    height: 25px;
    margin-left: auto;
    margin-right: auto;
    line-height: 25px;
    padding:0px 5px;
}
.ordertype-pay{
  background: #ff5d38;
}
.ordertype-online{
    background: #666;
}
</style>
<div id="tab_nav" class="MiiTab">
  <div class="tabBar clearfix"><span>基本信息</span><span>交易信息</span><span>预约管理</span></div>
    <div class="tabCon">
    <div class="panel we7-panel ng-scope" >
        <div class="panel-body we7-padding">
            <div class="form-horizontal">
                  <div class="form-group" style="border-bottom: #eee 1px solid;padding-bottom: 5px;">
                  <label class="col-sm-2 control-label" style=" height: 50px; line-height: 50px;">粉丝头像</label>  
                  <label class="col-sm-2 control-label"><img style="width: 50px; height: 50px;border-radius: 50%;display: block;"  src="{$o['avatar']}"></label>
                  </div> 
<!-- //              -->
          <div class="form-group">
            <label class="col-sm-2 control-label">微信昵称</label>
            <div class="col-sm-5 control-label" style="text-align: left;">
              {$o['nickname']}
            </div>           
          </div>
<!-- // -->   
<!-- //-->
          <div class="form-group">
            <label class="col-sm-2 control-label">OPENID:</label>
            <div class="col-sm-5 control-label" style="text-align: left;">
              {$o['openid']}
            </div>           
          </div>
<!-- // -->                 
<!-- //              -->
          <div class="form-group">
            <label class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-5 control-label" style="text-align: left;">
              {$o['uName']}
            </div>
            <div class="col-sm-3 control-label" style="text-align: left;">
              <span class="editmember" data-name="{$o['uName']}" data-phone="{$o['uPhone']}" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: rgb(224,180,59);color: #fff; border-radius: 2px;">修改</span>
            </div>            
          </div>
<!-- // -->
<!-- //              -->
          <div class="form-group">
            <label class="col-sm-2 control-label">手机</label>
            <div class="col-sm-5 control-label" style="text-align: left;">
              {$o['uPhone']}
            </div>
            <div class="col-sm-3 control-label" style="text-align: left;">
              <span class="editmember" data-name="{$o['uName']}" data-phone="{$o['uPhone']}" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: rgb(224,180,59);color: #fff; border-radius: 2px;">修改</span>
            </div>            
          </div>
<!-- // -->
<!-- //              -->
          <div class="form-group">
            <label class="col-sm-2 control-label">会员编号:</label>
            <div class="col-sm-5 control-label" style="text-align: left;">
              {if $o['activation']=='1'}
              <span class="details" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: #7800ff;color: #fff; border-radius: 2px;">{$o['mcard_on']}</span>
              
              {else}
              <span class="details" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: #9c9c9c;color: #fff; border-radius: 2px;">未激活</span>
              {/if}
            </div>
            <div class="col-sm-3 control-label" style="text-align: left;">
              {if $o['activation']!='1'}
              <span class="activation" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: rgb(224,180,59);color: #fff; border-radius: 2px;">激活</span>
              {else}
              {/if}
            </div>            
          </div>
<!-- // -->
<!-- //              -->
          <div class="form-group">
            <label class="col-sm-2 control-label">会员等级:</label>
            <div class="col-sm-5 control-label" style="text-align: left;">
              {if $o['activation']=='1'}
              <span class="details" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: rgb(224,180,59);color: #fff; border-radius: 2px;">{php echo memberlevel($o['consumption']);}</span>
              {else}
              <span class="details" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: #9c9c9c;color: #fff; border-radius: 2px;">普通会员</span>
              {/if}
            </div>
<!--             <div class="col-sm-3 control-label" style="text-align: left;">
              <span class="details" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: rgb(224,180,59);color: #fff; border-radius: 2px;">修改</span>
            </div> -->            
          </div>
<!-- // -->
<!-- //              -->
          <div class="form-group">
            <label class="col-sm-2 control-label">会员卡余额:</label>
            <div class="col-sm-5 control-label" style="text-align: left; color: #ff5d38;">
              {if $o['mid']}{$o['balance']}{else}0.00{/if}
            </div>
            <div class="col-sm-3 control-label" style="text-align: left;">
              <span class="m-recharge" data-balance="{$o['balance']}" data-ac="{$o['activation']}" data-uid="{$o['uid']}" style="cursor:pointer;padding:2px 5px;background: rgb(224,180,59);color: #fff; border-radius: 2px;">充值</span>
            </div>            
          </div>
<!-- // -->
<!-- // -->
          <div class="form-group">
            <label class="col-sm-2 control-label">消费总额:</label>
            <div class="col-sm-5 control-label" style="text-align: left;color: #ff5d38;">
              {if $o['mid']}{$o['consumption']}{else}0.00{/if}
            </div>
            <div class="col-sm-3 control-label" style="text-align: left;">
            </div>            
          </div>
<!-- // -->

            </div>
        </div>
        </div>            
    </div>
  <div class="tabCon">
 {if $order}   
{loop $order $key $t}   
<div class="list_th">
        <div class="td" style=" width:30%;">
         <div class="left_padding"><b>订单编号:</b>{$t['uniontid']}</div>
        </div>
        <div class="td text-center" style=" width:30%;"><b>创建时间:</b>{php echo date('Y-m-d H:i:s',$t['addtime'])} </div>
        <div class="td text-center" style=" width:30%;"><b>支付时间:</b>{php echo date('Y-m-d H:i:s',$o['pay_time'])} </div>
        <div class="clear"></div>
    </div>
    <div class="list_tr link_bk">
            <div class="td text-center border-r" style=" width:10%;line-height: 50px;" >
              <span>订单标题</span>
              <span class="info">{php echo deser($t['note'],'title')}</span> 
            </div>
            <div class="td text-center" style=" width:10%;line-height: 50px;" >
              <span class="title">订单类型</span>
              {if $t['type']=='onlinecheck'}
              <span class="ordertype ordertype-pay">在线买单</span> 
                {else if $t['type']=='recharge_mcard'}
                <span class="ordertype ordertype-online">会员卡充值</span>
                {else}
                <span class="ordertype ordertype-online">其他类型</span>
                {/if}     
            </div>            
            <div class="td text-center" style=" width:10%; line-height: 50px;" >    
              <span>支付类型</span>
              {if $t['pay_type']=='wechat'}
              <span class="ordertype ordertype-pay">微信支付</span> 
                {else if $t['pay_type']=='mcard'}
                <span class="ordertype ordertype-online">会员卡支付</span>
                {else if $t['pay_type']=='ADMIN'}
                <span class="ordertype ordertype-online">后台充值</span>
              {/if}     
            </div> 
            <div class="td text-center" style=" width:8%; line-height: 50px;" >
              <span>支付金额</span>
              <span class="info">{$t['fee']}</span>    
            </div>
            <div class="td text-center" style=" width:8%; line-height: 50px;" >
                <span>订单总额</span>
                <span class="info">{php echo deser($t['note'],'tmoney')}</span>      
            </div>             
            <div class="td text-center" style=" width:8%; line-height: 50px;" >
                <span>会员卡优惠</span>
                <span class="info">{$t['mcard_fee']}</span>      
            </div>            
            <div class="td text-center" style=" width:8%;line-height: 50px;" >
              <span>优惠券优惠</span>
              <span class="info">{$t['card_fee']}</span>
            </div>
            <div class="td text-center" style=" width:10%; line-height: 50px;" >
                <span>系统赠送</span>
                <span class="info">{$t['give']}</span>      
            </div> 
            <div class="td text-center" style=" width:8%;line-height: 50px;" >
              <span>订单状态</span>
                {if $t['status']=='1'}
                <span class="info ordertype isok">已支付</span>
                {elseif $t['status']=='0'}
                <span class="info ordertype isoff">未支付</span>    
                {/if}
            </div>                                                                           
            <div class="td edit text-center" style=" width:20%;">   
                <div class="list_right btn">
                    <a class="green isokpaylog" data-oid="{$t['oid']}" data-sid ="{$t['status']}" >确认支付</a>
                    <a class="gray deletepaylog" data-oid="{$t['oid']}"">删除</a>                    
                </div>
            </div>
            <div class="clear"></div>
        </div>
 <div class="list_tr gl"></div> 
{/loop}
{else}
<div class="list_tr link_bk" style="text-align: center;">没有预约记录</div> 
{/if}
<!--  -->

  </div>
  <div class="tabCon">
{if $book}
{loop $book $k $b}
    <div class="list_th">
        <div class="td" style=" width:20%;">
         <div class="left_padding"><b>订单编号:</b>{$b['orderid']}</div>
        </div>
        <div class="td text-center" style=" width:30%;"><b>创建时间:</b>{php echo date('Y-m-d H:i:s',$b['addtime'])} </div>
        <div class="td text-center" style=" width:30%;"><b>预约时间:</b>{php echo date('Y-m-d H:i:s',dejson($b['details'],'booktime'))} </div>
        <div class="clear"></div>
    </div>
    <div class="list_tr link_bk">
            <div class="td text-center padding" style=" width:10%;">
              <img class="goods-img" src="{$_W['attachurl']}{$b['titlepic']}">
                <div class="clear"></div>
            </div>
            <div class="td text-center border-r" style=" width:10%;line-height: 50px;" >
              <span>项目名称</span>
              <span class="info">{php echo dejson($b['details'],'goodsname')}</span> 
            </div>
            <div class="td text-center" style=" width:10%;line-height: 50px;" >
              <span class="title">顾客姓名</span>
              <span class="info">{php echo dejson($b['details'],'uname')}</span> 
            </div>            
            <div class="td text-center" style=" width:10%; line-height: 50px;" >    
              <span>技师名称</span>
              <span class="info">{php echo dejson($b['details'],'techname')}</span> 
            </div> 
            <div class="td text-center" style=" width:8%; line-height: 50px;" >
              <span>预定类型</span>
                {if $b['order_type']=='2'}
              <span class="ordertype ordertype-pay">支付预约</span> 
                {else if $b['order_type']=='1'}
                <span class="ordertype ordertype-online">免费预约</span>
                {else}
                <span class="ordertype ordertype-online">其他类型</span>
                {/if}     
            </div>
            <div class="td text-center" style=" width:10%; line-height: 50px;" >
                <span>在线支付</span>
                <span class="info">¥ {$b['pay_money']}</span>      
            </div>             
            <div class="td text-center" style=" width:10%; line-height: 50px;" >
                <span>到店需付</span>
                <span class="info">¥ {php echo $b['tmoney']-$b['pay_money']}</span>      
            </div>            
            <div class="td text-center" style=" width:10%;line-height: 50px;" >
              <span>订单状态</span>
                {if $b['is_ok']=='0'}
              <span class="info ordertype isoff">未完成</span>
                {else if $b['is_ok']}
                <span class="info ordertype isok">已完成</span>    
                {/if}
            </div>                                                  
            <div class="td edit text-center" style=" width:22%;">   
                <div class="list_right btn">
                    <a href="{php echo $this->createWebUrl('order_details',array('oid'=>$b['oid']));}">详情</a>
                    <a class="green isokbook" data-oid="{$b['oid']}" data-sid ="{$b['is_ok']}" >确认完成</a>
                    <a class="gray deletebook" data-did="{$b['oid']}" data-bid ="{$b['book_id']}">删除</a>                    
                </div>
            </div>
            <div class="clear"></div>
        </div>
 <div class="list_tr gl"></div> 
 {/loop}
 {else}
<div class="list_tr link_bk" style="text-align: center;">没有预约记录</div> 
 {/if}      

  </div>
</div>
<link rel="stylesheet" type="text/css" href="{MODULE_URL}public/sweetalert/sweetalert2.min.css"> 
<script src="{MODULE_URL}public/sweetalert/es6-promise.min.js"></script> 
<script type="text/javascript">
$(function(){
$.Miitab("#tab_nav .tabBar span","#tab_nav .tabCon","current","click","{if $tab}{$tab}{else}0{/if}")});

jQuery.Miitab =function(tabBar,tabCon,class_name,tabEvent,i){
var $tab_menu=$(tabBar);
  // 初始化操作
  $tab_menu.removeClass(class_name);
  $(tabBar).eq(i).addClass(class_name);
  $(tabCon).hide();
  $(tabCon).eq(i).show();
  
  $tab_menu.bind(tabEvent,function(){
  	$tab_menu.removeClass(class_name);
      $(this).addClass(class_name);
      var index=$tab_menu.index(this);
      $(tabCon).hide();
      $(tabCon).eq(index).show()})}
</script>
<script type="text/javascript">
  $('.activation').on('click',function(){
    var uid = $.trim($(this).attr('data-uid'));
    activation(uid)
  })
  $('.editmember').on('click',function(){
    var uid = $.trim($(this).attr('data-uid'));
    var name = $.trim($(this).attr('data-name'));
    var phone = $.trim($(this).attr('data-phone'));
    editmember(uid,name,phone);
  })
  //确认支付

  $('.isokpaylog').on('click',function(){
    var oid = $.trim($(this).attr('data-oid'));
    var sid = $.trim($(this).attr('data-sid'));
    if(sid != '1'){
      swal({
          title: '确定确认该支付记录吗？', 
          type: 'warning',
          showCancelButton: true, 
          confirmButtonColor:'#7800ff',
          cancelButtonColor: '#d33',
          confirmButtonText: '确定', 
          cancelButtonText: '取消'
        }).then(function(confirm) {
          if(confirm){
            $.ajax({
                 url:"{php echo $this->createWebUrl('uppaylog');}&version_id="+"{$_GPC['version_id']}",
                 data:{oid:oid},
                 dataType:"json",
                 type:"post",
                success:function(res){
                   if(res.status== 1){
                        swal({
                            text: res.msg,
                            type: 'success',
                            confirmButtonText:'确认',
                            confirmButtonColor:'#7800ff',
                            preConfirm: function () {
                              window.location.href="{php echo $this->createWebUrl('memberdetails',array('uid'=>$o['uid'],'tab'=>'1'));}&version_id="+"{$_GPC['version_id']}"; 
                            }
                        })                        
                       return false;
                   }else{
                       swal({
                            text: res.msg,
                            type: 'error',
                            confirmButtonText:'确认',
                            confirmButtonColor:'#7800ff',                              
                        })
                       return false;
                   }
                }
              }) 
            }
          })
      }else{
          swal({
            title:'已确认,无需重复操作！',
            type:'warning',
            confirmButtonText:'确认',
            confirmButtonColor:'#7800ff'         
          })       
      }
  })  
//确认完成
$('.isokbook').on('click',function(){
    var oid = $.trim($(this).attr('data-oid'));
    var sid = $.trim($(this).attr('data-sid'));
    if(sid != '1'){
      swal({
          title: '确定确认该预约记录吗？', 
          type: 'warning',
          showCancelButton: true, 
          confirmButtonColor:'#7800ff',
          cancelButtonColor: '#d33',
          confirmButtonText: '确定', 
          cancelButtonText: '取消'
        }).then(function(confirm) {
          if(confirm){
            $.ajax({
                 url:"{php echo $this->createWebUrl('orderisok');}&version_id="+"{$_GPC['version_id']}",
                 data:{oid:oid},
                 dataType:"json",
                 type:"post",
                success:function(res){
                   if(res.status== 1){
                        swal({
                            text: res.msg,
                            type: 'success',
                            confirmButtonText:'确认',
                            confirmButtonColor:'#7800ff',
                            preConfirm: function () {
                              window.location.href="{php echo $this->createWebUrl('memberdetails',array('uid'=>$o['uid'],'tab'=>'2'));}&version_id="+"{$_GPC['version_id']}"; 
                            }
                        })                        
                       return false;
                   }else{
                       swal({
                            text: res.msg,
                            type: 'error',
                            confirmButtonText:'确认',
                            confirmButtonColor:'#7800ff',                              
                        })
                       return false;
                   }
                }
              }) 
            }
          })
      }else{
          swal({
            title:'已确认,无需重复操作！',
            type:'warning',
            confirmButtonText:'确认',
            confirmButtonColor:'#7800ff'         
          })       
      }
  })  
//激活
    function activation (mid){
      swal({
          title: '激活会员',
          confirmButtonText:'提交',
          showCancelButton:true,
          cancelButtonText:'取消',
          confirmButtonColor:'#7800ff',
          html:'<div class="form-horizontal"><div class="form-group"><label class="col-sm-3 control-label">会员姓名</label><div class="col-sm-8"><input type="text" class="form-control" id="m-name" name="name" value=""></div></div>'+
              '<div class="form-group"><label class="col-sm-3 control-label">会员手机</label><div class="col-sm-8"><input type="text" class="form-control" id="m-phone" name="info" value=""></div></div></div>',
          preConfirm: function () {
            return new Promise(function (resolve) {
              var name = $('#m-name').val();
              var phone = $('#m-phone').val();
              var reg = /^1[3|4|5|7|8][0-9]{9}$/              
              if(name==''){
                  swal.showValidationError('请输入会员姓名') 
                  return false
              }
              if(phone==''){
                  swal.showValidationError('请输入会员手机') 
                  return false
              }
              if(!(reg.test(phone))){
                  swal.showValidationError('请填写正确的会员手机')
                  return false
              }
              resolve([{'name':$('#m-name').val(),'phone':$('#m-phone').val()}])
            })
          },
          onOpen: function () {
            $('#m-name').focus()
          }
        }).then(function (res) {
          if(res){
               $.ajax({
                   url:"{php echo $this->createWebUrl('acmcard');}&version_id="+"{$_GPC['version_id']}",
                   data:{mid:mid,name:res[0]['name'],phone:res[0]['phone']},
                   dataType:"json",
                   type:"post",
                  success:function(res){
                     if(res.status== 1){
                          swal({
                              text: res.msg,
                              type: 'success',
                              confirmButtonText:'确认',
                              confirmButtonColor:'#7800ff',
                              preConfirm: function () {
                                window.location.reload(); 
                              }
                          })                        
                         return false;
                     }else{
                         swal({
                              text: res.msg,
                              type: 'error',
                              confirmButtonText:'确认',
                              confirmButtonColor:'#7800ff',                              
                          })
                         return false;
                     }
                  }
                })          
            }
        }).catch(swal.noop)      
    }
    //修改
      function editmember (mid,$name,$phone){
            swal({
                title: '修改会员信息',
                confirmButtonText:'提交',
                showCancelButton:true,
                cancelButtonText:'取消',
                confirmButtonColor:'#7800ff',
                html:'<div class="form-horizontal"><div class="form-group"><label class="col-sm-3 control-label">会员姓名</label><div class="col-sm-8"><input type="text" class="form-control" id="m-name" name="name" value="'+$name+'"></div></div>'+
                    '<div class="form-group"><label class="col-sm-3 control-label">会员手机</label><div class="col-sm-8"><input type="text" class="form-control" id="m-phone" name="info" value="'+$phone+'"></div></div></div>',
                preConfirm: function () {
                  return new Promise(function (resolve) {
                    var name = $('#m-name').val();
                    var phone = $('#m-phone').val();
                    var reg = /^1[3|4|5|7|8][0-9]{9}$/              
                    if(name==''){
                        swal.showValidationError('请输入会员姓名') 
                        return false
                    }
                    if(phone==''){
                        swal.showValidationError('请输入会员手机') 
                        return false
                    }
                    if(!(reg.test(phone))){
                        swal.showValidationError('请填写正确的会员手机')
                        return false
                    }
                    resolve([{'name':$('#m-name').val(),'phone':$('#m-phone').val()}])
                  })
                },
                onOpen: function () {
                  $('#m-name').focus()
                }
              }).then(function (res) {
                if(res){
                     $.ajax({
                         url:"{php echo $this->createWebUrl('editmcard');}&version_id="+"{$_GPC['version_id']}",
                         data:{mid:mid,name:res[0]['name'],phone:res[0]['phone']},
                         dataType:"json",
                         type:"post",
                        success:function(res){
                           if(res.status== 1){
                                swal({
                                    text: res.msg,
                                    type: 'success',
                                    confirmButtonText:'确认',
                                    confirmButtonColor:'#7800ff',
                                    preConfirm: function () {
                                      window.location.reload(); 
                                    }
                                })                        
                               return false;
                           }else{
                               swal({
                                    text: res.msg,
                                    type: 'error',
                                    confirmButtonText:'确认',
                                    confirmButtonColor:'#7800ff',                              
                                })
                               return false;
                           }
                        }
                      })          
                  }
              }).catch(swal.noop)      
          }    

        //充值会员卡
        $('.m-recharge').on('click',function(){
            var ac = $(this).attr('data-ac');
            var mid = $(this).attr('data-uid');
            var balance = parseFloat($(this).attr('data-balance')).toFixed(2);
            var url = "{php echo $this->createWebUrl('rechargemcard');}&version_id="+"{$_GPC['version_id']}";
            if(ac == 1 && mid){
              swal({
                title: '请输入充值金额',
                input: 'text',
                showCancelButton: true,
                inputPlaceholder: '0.00',
                confirmButtonColor:'#7800ff',
                confirmButtonText: '充值',
                cancelButtonText:'取消',
                preConfirm: function(money) {
                  return new Promise(function(resolve, reject) {
                    if (isNaN(money) || money =='') {
                      swal.showValidationError('充值金额应为纯数字')
                    } 
                    else if(parseFloat(money).toFixed(2)>20000)
                    {
                      swal.showValidationError('充值金额过大,请分批充值')
                    }
                    else if(parseFloat(money).toFixed(2)<0 && Math.abs(money)>balance)
                    {
                      swal.showValidationError('所扣余额不足,无法进行扣除操作');
                    }
                    else
                    {
                      resolve();
                    }
                  });
                },
                allowOutsideClick: false
              }).then(function(money) {
                if(money){
                    var data = {mid:mid,money:money,validata:1};
                    $.ajax({
                       url:url,
                       data:data,
                       dataType:"json",
                       type:"post",
                       success:function(res){
                          if(res.status==1){
                              swal({
                                  type: 'success',
                                  text: res.msg,
                                  confirmButtonText:'确认',
                                  confirmButtonColor:'#7800ff',
                                  preConfirm: function () {
                                    window.location.reload(); 
                                  }
                              });
                          }else{
                            swal({
                                type: 'error',
                                text: res.msg,
                                confirmButtonText:'确认',
                                confirmButtonColor:'#7800ff',
                            });
                          }
                       },fail:function(res){

                       }
                  });
                }                 
              })
            }else{
              swal({
                title:'请先激活会员',
                text:'会员未激活，不可进行充值操作',
                type:'warning', 
                confirmButtonText:'激活',
                cancelButtonText:'取消',
                confirmButtonColor:'#7800ff', 
                showCancelButton:true,
                preConfirm:function(){
                  activation(mid);
                }                
              })
            }
        })
  //删除订单日志
 $(document).on('click','.deletepaylog', function () {
        var oid = $(this).attr('data-oid');
        swal({
          title: '确定删除该记录吗？', 
          text: '你将无法恢复已删除记录！', 
          type: 'warning',
          showCancelButton: true, 
          confirmButtonColor:'#7800ff',
          cancelButtonColor: '#d33',
          confirmButtonText: '确定删除！', 
          cancelButtonText: '取消删除！'
        }).then(function(confirm) {
          if(confirm){
           $.ajax({
               url:"{php echo $this->createWebUrl('delpaylog');}&version_id="+"{$_GPC['version_id']}",
               data:{oid:oid},
               dataType:"json",
               type:"post",
              success:function(res){
                 if(res.status== 1){
                     swal({
                        title:res.msg,
                        type:'success',
                        confirmButtonColor:'#7800ff',
                        preConfirm:function()
                        {
                          window.location.href="{php echo $this->createWebUrl('memberdetails',array('uid'=>$o['uid'],'tab'=>'1'));}&version_id="+"{$_GPC['version_id']}"; 
                        }
                      });                      
                     return false;
                 }else{
                     swal({
                      title:res.msg,
                      type:'error'
                     })
                     return false;
                 }
              }
            })            
         }
        })             
    });  
//删除预约记录
$(document).on('click','.deletebook', function () {
        var did = $(this).attr('data-did');
        var bid = $(this).attr('data-bid');
        swal({
          title: '确定删除该记录吗？', 
          text: '你将无法恢复已删除记录！', 
          type: 'warning',
          showCancelButton: true, 
          confirmButtonColor:'#7800ff',
          cancelButtonColor: '#d33',
          confirmButtonText: '确定删除！', 
          cancelButtonText: '取消删除！'
        }).then(function(confirm) {
          if(confirm){
           $.ajax({
               url:"{php echo $this->createWebUrl('orderdel');}&version_id="+"{$_GPC['version_id']}",
               data:{did:did,bid:bid},
               dataType:"json",
               type:"post",
              success:function(res){
                 if(res.status== 1){
                     swal({
                        title:res.msg,
                        type:'success',
                        confirmButtonColor:'#7800ff',
                        preConfirm:function()
                        {
                          window.location.href="{php echo $this->createWebUrl('memberdetails',array('uid'=>$o['uid'],'tab'=>'2'));}&version_id="+"{$_GPC['version_id']}"; 
                        }
                      });                      
                     return false;
                 }else{
                     swal({
                      title:res.msg,
                      type:'error'
                     })
                     return false;
                 }
              }
            })            
         }
        })             
    });         
</script>
{template 'common/footer'}